<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title>个人申请详情</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../common/mui/mui.css" rel="stylesheet" />
		<link href="../../common/css/yahei.css" rel="stylesheet" />
		<link href="../../common/css/iconfont.css" rel="stylesheet" />
		<link href="../../common/css/app.css" rel="stylesheet" />
		<link href="../../dependence/wkplatform/css/ky/kyDetail.css" rel="stylesheet" />
		<style>
			.leftText {
				width: var(--size120);
				text-align: right;
			}
			
			.rightText {
				width: calc(100% - var(--size120));
			}
			.statusIcon .nur-shenhezhong{
				color: goldenrod;
			}
		</style>
	</head>

	<body class="YaHei">
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">详情</h1>
		</header>
		<div class="mui-content">
			<div class="headArea">
				<div id="applyer" class="headTitle mui-ellipsis">申请人 备案</div>
				<div id="appLoc" class="headLine mui-ellipsis">申请科室：</div>
				<div id="appDate" class="headLine mui-ellipsis">提交时间：</div>
				<div id="statusIcon" class="statusIcon"><div class=""></div></div>
			</div>
			<div id="wrapper" class="mui-scroll-wrapper">
				<div id="scroll" class="mui-scroll mui-scroll-phone">
					<ul id="middleUL" class="mui-table-view"></ul>
					<ul id="processUL" class="mui-table-view"></ul>
				</div>
			</div>
		</div>
		<script src="../../common/mui/mui.js"></script>
		<script src="../../common/js/jquery-3.4.1.min.js"></script>
		<script src="../../common/js/globalSet.js"></script>
		<script src="../../common/js/DHCWebService.js"></script>
		<script type="text/javascript">
	var pageType,source;
	mui.init();
	mui.plusReady(function() {
		baseSetup();
	})
	if (!mui.os.plus) {
		baseSetup()
	}
	
	function getDetailInfo(method,type,id){
		var pdict = {'id':id}
		var paramDict = {'method':method,'params':JSON.stringify(pdict),'type':type}
		mui.DHCWebService(paramDict, function(result) {
			console.log(method+' '+JSON.stringify(result))
			var dataDict = result['data']
			if (!dataDict) {
				mui.toast('请重试')
				return 
			}
			var AppStatus = dataDict['AppStatus']
			var statusIcon = ''
			var process = 'dealing'
			var processIcon = 'nur-zanting'
			switch (AppStatus){
				case '已提交':
					statusIcon = 'nur-statusR'
					break;
				case '护士长审核':
				case '科护士长审核':
					statusIcon = 'nur-shenhezhong'
					break;
				case '审核通过':
					statusIcon = 'nur-statusA'
					process = 'pass'
					processIcon = 'nur-correct'
					break;
				case '驳回':
					statusIcon = 'nur-statusB'
					process = 'refuse'
					processIcon = 'nur-error'
					break;
				default:
					break;
			}
			mui('#applyer')[0].innerHTML = dataDict['AppNur'] + ' ' +pageType
			mui('#appLoc')[0].innerHTML = '所属病区：'+dataDict['AppWard']
			mui('#statusIcon')[0].innerHTML = '<div class="nurfont '+statusIcon+'"></div>'
			mui('#appDate')[0].innerHTML = '提交时间：'+(dataDict['CreateDate']||"")+' '+(dataDict['CreateTime']||"")
			
			var html = '<li class="mui-table-view-cell"><div class="leftText">年龄：</div><div class="rightText">'+dataDict['AppNurAge']+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">层级：</div><div class="rightText">'+dataDict['AppNurLevel']+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">学历：</div><div class="rightText">'+dataDict['AppNurAcade']+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">职称：</div><div class="rightText">'+dataDict['AppNurDuty']+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">申请日期：</div><div class="rightText">'+dataDict['AppDate']+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">状态：</div><div class="rightText">'+AppStatus+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">现工作岗位：</div><div class="rightText">'+(dataDict['AppPositionDesc']||"")+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">申请何种岗位：</div><div class="rightText">'+(dataDict['AppWPositionDesc']||"")+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">理由：</div><div class="rightText">'+dataDict['AppReason']+'</div></li>'
			mui('#middleUL')[0].innerHTML = html
			var processHtml = '<li class="mui-table-view-cell '+process+'">'+
					'<div class="processIcon"><div class="nurfont '+processIcon+'"></div></div>'+
					'<div class="oneline">'+
						'<div class="dealName mui-ellipsis">'+AppStatus+'</div>'+
						// '<div class="dealDate">'+dateValue+'</div>'+
					'</div>'+
					// '<div class="dealLoc mui-ellipsis">'+opinion+'</div>'+
				'</li>'+
				'<li class="mui-table-view-cell">'+
					'<div class="processIcon"><div class="nurfont nur-nocheck"></div></div>'+
					'<div class="oneline">'+
						'<div class="dealName mui-ellipsis">'+ dataDict['AppNur']+'  提交</div>'+
						'<div class="dealDate">'+(dataDict['CreateDate']||"")+' '+(dataDict['CreateTime']||"")+'</div>'+
					'</div>'+
					'<div class="dealLoc mui-ellipsis">'+dataDict['AppWard']+'</div>'+
				'</li>'
			mui('#processUL')[0].innerHTML = processHtml
		}, function(errorStr) {
			mui.toast('请重试')
		});
	}

	function updateUI(dict){
		var Status = dict['LeaveStatus']; // 状态 B：驳回 Y：提交 NA：护士长审核 ZA：科护士长审核 HA：护理部审核
		var statusIcon = 'nur-status'+Status
		if (Status == 'Y') { //已提交
			statusIcon = 'nur-statusR'
		}else if (source == 'N'&&Status.indexOf('A') != -1) { //护士请假--一层审批:护士长/科护士长/护理部谁审批都行
			statusIcon = 'nur-statusA'
		}else if (source == 'H' && Status == "HA") {
			statusIcon = 'nur-statusA'
		}else if (source == 'H' && Status == 'ZA') {
			statusIcon = 'nur-shenhezhong'
		}
		mui('#applyer')[0].innerHTML = dict['CreatorName'] + ' ' +pageType
		mui('#appLoc')[0].innerHTML = '所属病区：'+dict['LeaveWardDesc']
		mui('#statusIcon')[0].innerHTML = '<div class="nurfont '+statusIcon+'"></div>'
		mui('#appDate')[0].innerHTML = '提交时间：'+dict['CreateDate']+' '+dict['CreateTime']
		
		var leaveDate = dict['LeaveStDate']
		if (leaveDate != dict['LeaveEndDate']) {
			leaveDate = leaveDate +' - '+dict['LeaveEndDate']
		}
		var html = '<li class="mui-table-view-cell"><div class="leftText">请假类型：</div><div class="rightText">'+dict['LeaveTypeDesc']+'</div></li>'+
			'<li class="mui-table-view-cell"><div class="leftText">请假时间：</div><div class="rightText">'+leaveDate+'</div></li>'+
			'<li class="mui-table-view-cell"><div class="leftText">请假时长：</div><div class="rightText">'+dict['LeaveTotal']+'</div></li>'
		if (source == 'H') {
			html += '<li class="mui-table-view-cell"><div class="leftText">请假事由：</div><div class="rightText">'+dict['LeaveReason']+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">请假所在地：</div><div class="rightText">'+dict['LeavePosition']+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">临时负责人：</div><div class="rightText">'+dict['LeaveCharger']+'</div></li>'+
				'<li class="mui-table-view-cell"><div class="leftText">临时负责人电话：</div><div class="rightText">'+dict['LeaveChargerTel']+'</div></li>'
		}
		mui('#middleUL')[0].innerHTML = html

		var approveClass = 'dealing'
		var approveText = '待审核'
		var approveIcon = 'nur-zanting'
		if (Status == 'B') {
			approveText = '审核不通过'
			approveClass = 'refuse'
			approveIcon = 'nur-error'
		}else if (Status.indexOf('A') != -1) {
			approveClass = 'pass';
			approveText = '审核通过';
			approveIcon = 'nur-correct'
		}
		var auditorHtml = ""
		var nameValue = dict['AuditorName'] //护士长审批
		var dateValue = dict['AuditDate'] + ' '+dict['AuditTime']
		var opinion = dict['AuditOpinion']==undefined?"":dict['AuditOpinion']
		if (source == 'N') { //护士请假 一层审批即可
			if (nameValue == '') {
				nameValue = dict['ZAuditorName'] //科护士长审批
				dateValue = dict['ZAuditDate'] + ' '+dict['ZAuditTime']
				opinion = dict['ZAuditOpinion']
			}
			if (nameValue == '') {
				nameValue = dict['HAuditorName'] //护理部审批
				dateValue = dict['HAuditDate'] + ' '+dict['HAuditTime']
				opinion = dict['HAuditOpinion']
			}
		}else{ //护士长请假备案 多层审批
			if (Status == 'ZA') { //科护士长审批
				nameValue = dict['ZAuditorName']
				dateValue = dict['ZAuditDate'] + ' '+dict['ZAuditTime']
				opinion = dict['ZAuditOpinion']
				auditorHtml += '<li class="mui-table-view-cell dealing">'+
					'<div class="processIcon"><div class="nurfont nur-zanting"></div></div>'+
					'<div class="oneline">'+
						'<div class="dealName mui-ellipsis">护理部审批</div>'+
						'<div class="dealDate"></div>'+
					'</div>'+
					'<div class="dealLoc mui-ellipsis"></div>'+
				'</li>';
			}else if (Status == 'HA') { //护理部审批
				nameValue = dict['HAuditorName'] //护理部审批
				dateValue = dict['HAuditDate'] + ' '+dict['HAuditTime']
				opinion = dict['HAuditOpinion']
				if (dict['ZAuditorName'] != '') { //经过了科护士长审批
					auditorHtml += '<li class="mui-table-view-cell pass">'+
						'<div class="processIcon"><div class="nurfont nur-correct"></div></div>'+
						'<div class="oneline">'+
							'<div class="dealName mui-ellipsis">'+nameValue+' '+approveText+'</div>'+
							'<div class="dealDate">'+dateValue+'</div>'+
						'</div>'+
						'<div class="dealLoc mui-ellipsis">'+opinion+'</div>'+
					'</li>';
					nameValue = dict['ZAuditorName'] //护理部审批
					dateValue = dict['ZAuditDate'] + ' '+dict['ZAuditTime']
					opinion = dict['ZAuditOpinion']
					approveClass = ''
					approveIcon = 'nur-nocheck'
				}
			}else if (Status == 'B') {
				nameValue = dict['HAuditorName'] //护理部驳回
				dateValue = dict['HAuditDate'] + ' '+dict['HAuditTime']
				opinion = dict['HAuditOpinion']
				if (dict['ZAuditorName'] == '') { //护理部直接驳回
					
				}else if(nameValue == ""){ //科护士长直接驳回
					nameValue = dict['ZAuditorName'] //护理部驳回
					dateValue = dict['ZAuditDate'] + ' '+dict['ZAuditTime']
					opinion = dict['ZAuditOpinion']
				}else{ //科护士长通过 护理部驳回
					auditorHtml += '<li class="mui-table-view-cell '+approveClass+'">'+
						'<div class="processIcon"><div class="nurfont '+approveIcon+'"></div></div>'+
						'<div class="oneline">'+
							'<div class="dealName mui-ellipsis">'+ nameValue+'  '+approveText+'</div>'+
							'<div class="dealDate">'+dateValue+'</div>'+
						'</div>'+
						'<div class="dealLoc mui-ellipsis">'+opinion+'</div>'+
					'</li>';
					nameValue = dict['ZAuditorName']
					dateValue = dict['ZAuditDate'] + ' '+dict['ZAuditTime']
					opinion = dict['ZAuditOpinion']
					approveClass = ''
					approveIcon = 'nur-nocheck'
				}
			}
		}
		auditorHtml += '<li class="mui-table-view-cell '+approveClass+'">'+
			'<div class="processIcon"><div class="nurfont '+approveIcon+'"></div></div>'+
			'<div class="oneline">'+
				'<div class="dealName mui-ellipsis">'+ nameValue+'  '+approveText+'</div>'+
				'<div class="dealDate">'+dateValue+'</div>'+
			'</div>'+
			'<div class="dealLoc mui-ellipsis">'+opinion+'</div>'+
		'</li>';
		
		var processHtml = auditorHtml+'<li class="mui-table-view-cell">'+
				'<div class="processIcon"><div class="nurfont nur-nocheck"></div></div>'+
				'<div class="oneline">'+
					'<div class="dealName mui-ellipsis">'+ dict['CreatorName']+'  提交</div>'+
					'<div class="dealDate">'+dict['CreateDate']+' '+dict['CreateTime']+'</div>'+
				'</div>'+
				'<div class="dealLoc mui-ellipsis">'+dict['LeaveWardDesc']+'</div>'+
			'</li>'
		mui('#processUL')[0].innerHTML = processHtml
	}
	
	function baseSetup(){
		mui('.mui-scroll-wrapper').scroll({
			bounce: true,
			indicators: false, //是否显示滚动条
		});
		var self = plus.webview.currentWebview()
		pageType = self.title
		var sourceData = self.sourceData
		switch (pageType){
			case '请假申请':
				source="N"
				updateUI(sourceData)
				break;
			case '护士长请假':
				source="H"
				updateUI(sourceData)
				break;
			case '调岗申请':
				getDetailInfo("web.INMPersonComm:GetTransPosition","RecMethod",sourceData['RowID']);
			default:
				break;
		}
		
		mui('.mui-title')[0].innerText = pageType
	}
/*
护士长请假备案
	护士长请假Y--科护士长审核ZA--护理部审核HA(审批结束)
	B状态驳回(审批结束)
	{"LeaveSource":"H","LeaveWard":"2","LeaveWardDesc":"内分泌科护理单元","LeaveType":"6","LeaveTypeDesc":"休假","LeaveStDate":"2022-05-31","LeaveStTime":"00:00",
	"LeaveEndDate":"2022-05-31","LeaveEndTime":"23:59","LeaveTotal":"1天","LeaveReason":"就是想请假","LeavePosition":"郑州","LeaveCharger":"小李",
	"LeaveChargerTel":"13262156210","LeaveStatus":"Y","LeaveReasonDesc":"提交","Creator":"31","CreatorName":"傅国宁","CreateDate":"2022-05-31",
	"CreateTime":"15:56:12","Auditor":"","AuditorName":"","AuditDate":"","AuditTime":"","ZAuditor":"","ZAuditorName":"","ZAuditDate":"",
	"ZAuditTime":"","HAuditor":"","HAuditorName":"","HAuditDate":"","HAuditTime":"","AuditOpinion":"","ZAuditOpinion":"","HAuditOpinion":"","rw":"8","WorkDate":""}]

请假申请
	护士请假Y---护士长审核NA(审批结束)
	{"LeaveSource":"N","LeaveWard":"2","LeaveWardDesc":"内分泌科护理单元","LeaveType":"6","LeaveTypeDesc":"休假","LeaveStDate":"2022-05-31","LeaveStTime":"00:00",
	"LeaveEndDate":"2022-05-31","LeaveEndTime":"23:59","LeaveTotal":"1天","LeaveReason":"","LeavePosition":"","LeaveCharger":"","LeaveChargerTel":"",
	"LeaveStatus":"NA","LeaveReasonDesc":"审核","Creator":"31","CreatorName":"傅国宁","CreateDate":"2022-05-31","CreateTime":"17:13:08","Auditor":"34",
	"AuditorName":"护士01","AuditDate":"2022-05-31","AuditTime":"18:51:59","ZAuditor":"","ZAuditorName":"","ZAuditDate":"","ZAuditTime":"","HAuditor":"",
	"HAuditorName":"","HAuditDate":"","HAuditTime":"","AuditOpinion":"批准喽","ZAuditOpinion":"","HAuditOpinion":"","rw":"9","WorkDate":""}
调岗申请
	{"AppDate":"2020-10-29","AppNur":"周月绮","AppNurAcade":"","AppNurAge":"30","AppNurDuty":"","AppNurID":"6","AppNurLevel":"N2","AppPosition":"",
	"AppReason":"调岗申请","AppStatus":"护士长审核","AppWPosition":"24||1","AppWard":"CCU","RowID":"3"}
*/ 

		</script>
	</body>

</html>

